import request from "@/plugin/axios";

const BASE_URL = "sys/role";

export function RoleList(data) {
  return request({
    url: BASE_URL + "/page",
    method: "get",
    params: data,
  });
}

export function RoleListSimple(data) {
  return request({
    url: BASE_URL + "/simple",
    method: "get",
    params: data,
  });
}

export function RoleSimpleList(roleId) {
  return request({
    url: BASE_URL + "/" + roleId + "/simple/user",
    method: "get",
  });
}

export function RoleAdd(data) {
  return request({
    url: BASE_URL,
    method: "post",
    data,
  });
}

export function RoleUpdate(data) {
  return request({
    url: BASE_URL + "/" + data.id,
    method: "put",
    data,
  });
}

export function RoleDel(roleId) {
  return request({
    url: BASE_URL + "/" + roleId,
    method: "delete",
  });
}

export function RoleStatusChange(roleId) {
  return request({
    url: BASE_URL + "/" + roleId + "/state",
    method: "put",
  });
}

export function RoleMenuPermBatch(data) {
  return request({
    url: BASE_URL + "/menu-perm",
    method: "put",
    data,
  });
}

export function RoleMenuPerm(roleId) {
  return request({
    url: BASE_URL + "/" + roleId + "/menu/perm",
    method: "get",
  });
}

export function RoleUserBatch(data) {
  return request({
    url: BASE_URL + "/user",
    method: "post",
    data,
  });
}

export function RoleSimpleUser(roleId) {
  return request({
    url: BASE_URL + "/" + roleId + "/simple/user",
    method: "get",
  });
}

export function RolePowerList(data) {
  return request({
    url: BASE_URL + "power/list",
    method: "get",
    params: data,
  });
}
